<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>性生活恢复和避孕情况</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/page/weixin/questionnaire.css" />

<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/page/weixin/jweixin-1.0.0.js"></script>
</head>
<body>
<div data-role="page" id="page_questionnaire51">
<form id="frmqa51" method="post">
<input type="hidden" name="openId" value="${openId}">
<input type="hidden" id="batchNo" name="batchNo" value="${batchNo }">
<input type="hidden" name="questionnaireId" value="51">
<div data-role="content" id="questionnaire51">

M1流产后至今是否有过性生活？<br/>
<input id="question_96_1_186" name="question_96_1" type="radio" value="186" onclick="showDivQuestion('question_96_1','186')">是<br/>
<input id="question_96_1_187" name="question_96_1" type="radio" value="187" onclick="showDivQuestion('question_97_1','104')">否<br/>

<div id="div_question_96_1_97" name="div_question_96_1_186" style="display: none">
M2首次性生活是否采取避孕措施？<br/>
<input id="question_97_1_188" name="question_97_1" type="radio" value="188" onclick="showDivQuestion('question_97_1','98')">是<br/>
<input id="question_97_1_189" name="question_97_1" type="radio" value="189" onclick="showDivQuestion('question_97_1','104')">否<br/>
</div>

<div id="div_question_97_1_98" name="div_question_97_1_98" style="display: none">
M3避孕时采取下列哪种避孕方式？<br/>
<input id="question_98_1_190" name="question_98_1" type="radio" value="190" onclick="showDivQuestion('question_98_1','100')">短效口服避孕药<br/>
<input id="question_98_1_191" name="question_98_1" type="radio" value="191" onclick="showDivQuestion('question_98_1','101')">避孕套<br/>
<input id="question_98_1_192" name="question_98_1" type="radio" value="192">绝育（男性、女性）<br/>
<input id="question_98_1_193" name="question_98_1" type="radio" value="193">宫内节育器<br/>
<input id="question_98_1_194" name="question_98_1" type="radio" value="194">皮下埋植剂<br/>
<input id="question_98_1_195" name="question_98_1" type="radio" value="195" onclick="showDivQuestion('question_100_1','102')">紧急避孕药<br/>
<input id="question_98_1_196" name="question_98_1" type="radio" value="196" onclick="showDivQuestion('question_100_1','102')">安全期<br/>
<input id="question_98_1_197" name="question_98_1" type="radio" value="197" onclick="showDivQuestion('question_100_1','102')">体外排精<br/>
<input id="question_98_1_198" name="question_98_1" type="radio" value="198" onclick="showDivQuestion('question_100_1','102')">避孕栓/膏/膜<br/>
<input id="question_98_1_199" name="question_98_1" type="radio" value="199">避孕针<br/>
</div>

<div id="div_question_97_1_98" name="div_question_97_1_98" style="display: none">
M4获取这种避孕方法的渠道？<br/>
<input id="question_99_1_200" name="question_99_1" type="radio" value="200">提供流产服务的医院<br/>
<input id="question_99_1_201" name="question_99_1" type="radio" value="201">其他医院<br/>
<input id="question_99_1_202" name="question_99_1" type="radio" value="202">计生站/办<br/>
<input id="question_99_1_203" name="question_99_1" type="radio" value="203">药店/超市<br/>
<input id="question_99_1_204" name="question_99_1" type="radio" value="204">工作单位<br/>
<input id="question_99_1_205" name="question_99_1" type="radio" value="205">网上购买<br/>
<input id="question_99_1_206" name="question_99_1" type="radio" value="206">街头活动赠送<br/>
<input id="question_99_1_207" name="question_99_1" type="radio" value="207">其他<br/>
</div>

<div id="div_question_98_1_100" name="div_question_98_1_100" style="display: none">
是否坚持每天服药，没有遗漏？<br/>
<input id="question_100_1_208" name="question_100_1" type="radio" value="208" onclick="showDivQuestion('question_100_1','102')">是<br/>
<input id="question_100_1_209" name="question_100_1" type="radio" value="209">有过遗漏<br/>
</div>

<div id="div_question_98_1_101" name="div_question_98_1_101" style="display: none">
是否每次性生活都使用避孕套？<br/>
<input id="question_101_1_210" name="question_101_1" type="radio" value="210">是<br/>
<input id="question_101_1_211" name="question_101_1" type="radio" value="211">否<br/>
</div>

<div id="div_question_100_1_102" name="div_question_100_1_102" style="display: none">
M7你是否对现用避孕方法感到满意？<br/>
<input id="question_102_1_212" name="question_102_1" type="radio" value="212">很满意<br/>
<input id="question_102_1_213" name="question_102_1" type="radio" value="213">满意<br/>
<input id="question_102_1_214" name="question_102_1" type="radio" value="214">一般<br/>
<input id="question_102_1_215" name="question_102_1" type="radio" value="215">不满意<br/>
</div>

<div id="div_question_100_1_103" name="div_question_100_1_102" style="display: none">
M8你为什么选用这种方法？<br/>
<input id="question_103_1_216" name="question_103_1" type="radio" value="216">有效<br/>
<input id="question_103_1_217" name="question_103_1" type="radio" value="217">安全<br/>
<input id="question_103_1_218" name="question_103_1" type="radio" value="218">方便<br/>
<input id="question_103_1_219" name="question_103_1" type="radio" value="219">无副作用<br/>
<input id="question_103_1_220" name="question_103_1" type="radio" value="220">医生推荐<br/>
<input id="question_103_1_221" name="question_103_1" type="radio" value="221">亲属推荐<br/>
<input id="question_103_1_222" name="question_103_1" type="radio" value="222">朋友推荐<br/>
<input id="question_103_1_223" name="question_103_1" type="radio" value="223">便宜<br/>
<input id="question_103_1_224" name="question_103_1" type="radio" value="224">其他<br/>
</div>

<div id="div_question_97_1_104" name="div_question_97_1_104" style="display: none">
M9你是否有再生育的打算？<br/>
<input id="question_104_1_225" name="question_104_1" type="radio" value="225" onclick="showM10('question_104_1','105')">无<br/>
<input id="question_104_1_226" name="question_104_1" type="radio" value="226" onclick="showM10('question_104_1','')">有<br/>
</div>

<div id="div_question_104_1_105" name="div_question_104_1_105" style="display: none">
M10为什么不避孕？<br/>
<input id="question_105_1_227" name="question_105_1" type="radio" value="227">忘记<br/>
<input id="question_105_1_228" name="question_105_1" type="radio" value="228">偶尔不用，不会怀孕<br/>
<input id="question_105_1_229" name="question_105_1" type="radio" value="229">不知道怎么避孕<br/>
<input id="question_105_1_230" name="question_105_1" type="radio" value="230">没有避孕药具<br/>
<input id="question_105_1_231" name="question_105_1" type="radio" value="231">没有找到合适避孕方式<br/>
<input id="question_105_1_232" name="question_105_1" type="radio" value="232">男伴不愿意使用<br/>
<input id="question_105_1_233" name="question_105_1" type="radio" value="233">双方不愿意使用<br/>
<input id="question_105_1_234" name="question_105_1" type="radio" value="234">避孕药具太贵<br/>
<input id="question_105_1_235" name="question_105_1" type="radio" value="235">其他原因<br/>
</div>
</div>
<br/>
<div align="center">
	<a class="ui-btn ui-shadow ui-btn-corner-all" href="javascript:void(0)" onclick="submitFrm()" >
		<span class="ui-btn-inner">
			<span class="ui-btn-text">提交</span>
		</span>
	</a>
</div>
</form>
</div>
<div data-role="page" id="question51_diagnosis">
	<div data-role="content" id="question51_diagnosis_content">
		
	</div>
</div>

<script type="text/javascript">
wx.config({
    debug: false, 
    appId: '${appId}', 
    timestamp: '${timestamp}', 
    nonceStr: '${nonceStr}', 
    signature: '${signature}',
    jsApiList: ['closeWindow'] 
});

wx.error(function(res){
});

//显示关联问题
function showDivQuestion(qiestionId,val)
{
	$("div[name^='div_"+qiestionId+"']").each(function(i){  
		  $(this).css("display","none");
		  $(this).find("input[type='radio'],input[type='checkbox']").each(function(){
			  $(this).prop("checked", false);
		  });
	}); 
	$("div[name^='div_"+qiestionId+"_"+val+"']").each(function(i){  
		  $(this).css("display","block");
	}); 
}

//M10是否显示
function showM10(qiestionId,val)
{
	var q97V=$("input:radio[name='question_97_1']:checked").val();
	if(q97V=='189')
	{
		$("div[name^='div_"+qiestionId+"']").each(function(i){  
			  $(this).css("display","none");
			  $(this).find("input[type='radio'],input[type='checkbox']").each(function(){
				  $(this).prop("checked", false);
			  });
		}); 
		$("div[name='div_"+qiestionId+"_"+val+"']").each(function(i){  
			  $(this).css("display","block");
		});
	}
}

//检查表单
function checkQuestionnaireFrm()
{
	var question_96_val=$("input[name='question_96_1']:checked").val();
	if(null==question_96_val||""==question_96_val||undefined==question_96_val)
	{
		alert("请选择流产后至今是否有过性生活");
		return false;
	}
	
	var question_97_val=$("input[name='question_97_1']:checked").val();
	if((question_96_val=="186")&&(null==question_97_val||""==question_97_val||undefined==question_97_val))
	{
		alert("请选择首次性生活是否采取避孕措施");
		return false;
	}
	
	var question_98_val=$("input[name='question_97_1']:checked").val();
	if((question_97_val=="188")&&(null==question_98_val||""==question_98_val||undefined==question_98_val))
	{
		alert("请选择避孕时采取下列哪种避孕方式");
		return false;
	}
	
	var question_99_val=$("input[name='question_99_1']:checked").val();
	if((question_97_val=="188")&&(null==question_99_val||""==question_99_val||undefined==question_99_val))
	{
		alert("请选择获取这种避孕方法的渠道");
		return false;
	}
	
	var question_100_val=$("input[name='question_100_1']:checked").val();
	if((question_98_val=="190")&&(null==question_100_val||""==question_100_val||undefined==question_100_val))
	{
		alert("请选择是否坚持每天服药，没有遗漏");
		return false;
	}
	
	var question_101_val=$("input[name='question_101_1']:checked").val();
	if((question_98_val=="191")&&(null==question_101_val||""==question_101_val||undefined==question_101_val))
	{
		alert("请选择是否每次性生活都使用避孕套");
		return false;
	}
	
	var question_102_val=$("input[name='question_102_1']:checked").val();
	if((question_98_val=="195")&&(null==question_102_val||""==question_102_val||undefined==question_102_val))
	{
		alert("请选择你是否对现用避孕方法感到满意");
		return false;
	}
	
	var question_103_val=$("input[name='question_103_1']:checked").val();
	if((question_98_val=="195"||question_98_val=="196"||question_98_val=="197"||question_98_val=="198")&&(null==question_103_val||""==question_103_val||undefined==question_103_val))
	{
		alert("请选择你为什么选用这种方法");
		return false;
	}
	
	var question_104_val=$("input[name='question_104_1']:checked").val();
	if((question_97_val=="189"||question_96_val=="187")&&(null==question_104_val||""==question_104_val||undefined==question_104_val))
	{
		alert("请选择你是否有再生育的打算");
		return false;
	}
	
	var question_105_val=$("input[name='question_105_1']:checked").val();
	if((question_104_val=="255")&&(null==question_105_val||""==question_105_val||undefined==question_105_val))
	{
		alert("请选择为什么不避孕");
		return false;
	}
	
	return true;
	
}

//提交表单
function submitFrm()
{
	if(checkQuestionnaireFrm())
	{
		kuanrf.common.loading();
		$('#frmqa51').form('submit', {    
		    url:"${pageContext.request.contextPath}/weixin/qusetionnaire/answer",    
		    onSubmit: function(){     
		    },    
		    success:function(jsontext){   
		    	var data=JSON.parse(jsontext);
		    	if(data.result==true)
	        	{
		    		alert(data.diagnosis);
		    		wx.closeWindow();
	        	}  
		    	else
		    	{
		    		alert(data.msg);
		    	}
		    }    
		});  		
	}
}

</script>
</body>
</html>